<?php
/**************************************************************************
 * Naanal PHP Framework, Simple, Efficient and Developer Friendly
 * Ver 3.0, Copyright (C) <2010>  <Tamil Amuthan. R>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ************************************************************************/
class ClsWUser extends ClsWrapper
{
    public $userid=null;
    public $password=null;
    public $firstname=null;
    public $lastname=null;
    public $middlename=null;
    public $ssn=null;
    public $email=null;
    public $landline=null;
    public $mobile=null;
    public $address1=null;
    public $address2=null;
    public $state="";
    public $city=null;
    public $province=null;
    public $country=null;
    public $zip=null;
    public $active=null;
    public $sessionid=null;
    
    public function __construct($module="user")
    {
        $this->tableName="user";
        parent::__construct($module);
    }
    public function get_userid()
    {
        return $this->userid;
    }

    public function set_userid($userid)
    {
        $this->userid=$userid;
    }
    public function get_password()
    {
        return $this->password;
    }

    public function set_password($password)
    {
        $this->password=$password;
    }
    public function get_firstname()
    {
        return $this->firstname;
    }

    public function set_firstname($firstname)
    {
        $this->firstname=$firstname;
    }
    public function get_middlename()
    {
        return $this->middlename;
    }

    public function set_middlename($middlename)
    {
        $this->middlename=$middlename;
    }
    public function get_lastname()
    {
        return $this->lastname;
    }

    public function set_lastname($lastname)
    {
        $this->lastname=$lastname;
    }
    public function get_ssn()
    {
        return $this->ssn;
    }

    public function set_ssn($ssn)
    {
        $this->ssn=$ssn;
    }
    public function get_email()
    {
        return $this->email;
    }

    public function set_email($email)
    {
        $this->email=$email;
    }
    public function get_landline()
    {
        return $this->landline;
    }

    public function set_landline($landline)
    {
        $this->landline=$landline;
    }
    public function get_mobile()
    {
        return $this->mobile;
    }

    public function set_mobile($mobile)
    {
        $this->mobile=$mobile;
    }
    public function get_address1()
    {
        return $this->address1;
    }

    public function set_address1($address1)
    {
        $this->address1=$address1;
    }
    public function get_address2()
    {
        return $this->address2;
    }

    public function set_address2($address2)
    {
        $this->address2=$address2;
    }
    public function get_city()
    {
        return $this->city;
    }

    public function set_city($city)
    {
        $this->city=$city;
    }
    public function get_state()
    {
        return $this->state;
    }

    public function set_state($state)
    {
        $this->state=$state;
    }
    public function get_country()
    {
        return $this->country;
    }

    public function set_country($country)
    {
        $this->country=$country;
    }
    public function get_zip()
    {
        return $this->zip;
    }

    public function set_zip($zip) 
    {
        $this->zip=$zip;
    }
    public function get_name()
    {
        return $this->firstname." ".$this->lastname;
    }
    function getAssocList($arrWhere=array(),$isDistinct=true)
    {
        addLog("inside getObjList");
        $objSql=getNaanalLibObject("ClsNaanalSQL");
        $objSql->isDistinct=$isDistinct;
        $objSql->addTable($this->tableName);
        if($this->arrFilter)
        foreach($this->arrFilter as $where)
        {
            $arrWhere[]=$where;
        }
        if($this->arrJoin)
            $objSql->addJoinAsArray($this->arrJoin);
        if($arrWhere) $objSql->addWhereAsArray($arrWhere);
        $sql=$objSql->render(); 
        addLog($sql);
        $this->objPDO->setQuery($sql);
        return $this->objPDO->getAllAssoc();
    }
}
?>
